﻿// $(document).ready(function () {
$("#navbar").load("head.html");
var user = {};
$.ajax({
    url: '/checkuser',
    type: 'get',
    data: "",
    async: false,
    success: function (data, status) {
        if (status == 'success') {
            user = data;
        }
    },
    error: function (data, status) {
        if (status == 'error') {
            window.location.href = '/login';
        }
    }
});

var authority = [];
for (let i = 0; i < 20; i++) {
    authority[i] = user.user_power.charAt(i) * 1;
}
var navList = document.getElementById("navList");
if (authority[0] | authority[1]) {
    navList.innerHTML += "<li><a href=\"projectManage.html\" class=\"\" ><i class=\"menu-icon\">" +
        "</i>项目</a><b class=\"arrow\"></b></li>";
}
if (authority[2] | authority[3] | authority[4]) {
    navList.innerHTML += "<li><a href=\"deputeManage.html\" class=\"\" ><i class=\"menu-icon\">" +
        "</i>委托单</a><b class=\"arrow\"></b></li>";
}
if (authority[5] | authority[6] | authority[7] | authority[8]) {
    navList.innerHTML += "<li><a href=\"ReportManage.html\" class=\"\" ><i class=\"menu-icon\">" +
        "</i>报告</a><b class=\"arrow\"></b></li>";
}
if (authority[9]) {
    navList.innerHTML += "<li><a href=\"notificationManage.html\" class=\"\" ><i class=\"menu-icon\">" +
        "</i>通知单</a><b class=\"arrow\"></b></li>";
}
if (authority[10]) {
    navList.innerHTML += "<li><a href=\"evaluationRecord.html\" class=\"\" ><i class=\"menu-icon\">" +
        "</i>评片</a><b class=\"arrow\"></b></li>";
}
if (authority[11] | authority[12]) {
    navList.innerHTML += "<li><a href=\"tecCardManage.html\" class=\"\" ><i class=\"menu-icon\">" +
        "</i>工艺卡</a><b class=\"arrow\"></b></li>";
}
if (authority[14] | authority[15]) { // 主管——派工单，组长——派工单分配，检测人员——查看派工单
    navList.innerHTML += "<li><a href=\"workOrderManage.html\" class=\"\" ><i class=\"menu-icon\">" +
        "</i>派工单</a><b class=\"arrow\"></b></li>";
}
if (authority[16]) {
    navList.innerHTML += "<li><a href=\"groupManage.html\" class=\"\" ><i class=\"menu-icon\">" +
        "</i>检测小组</a><b class=\"arrow\"></b></li>";
}
if (authority[18]) {
    navList.innerHTML += "<li><a href=\"authorityManage.html\" class=\"\" ><i class=\"menu-icon\">" +
        "</i>分配权限</a><b class=\"arrow\"></b></li>";
    navList.innerHTML += "<li><a href=\"departmentManage.html\" class=\"\" ><i class=\"menu-icon\">" +
        "</i>检测部门</a><b class=\"arrow\"></b></li>";
}




function SendSuccess() {
    alert("发送成功");
}

function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r !== null) return unescape(r[2]); return null;
}
